import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 场地信息 */
export interface Venue {
          id: number; // 场地ID
          venueNo?: string; // 场地编码
          capacity?: number; // 容纳人数
          area: number; // 面积
          venueType: string; // 场地类型
  }

// 场地 API
export const VenueApi = {
  // 查询场地分页
  getVenuePage: async (params: any) => {
    return await request.get({ url: `/train/venue/page`, params })
  },

  // 查询场地列表
  getVenueList: async (params: any) => {
    return await request.get({ url: `/train/venue/list`, params })
  },

  // 查询场地详情
  getVenue: async (id: number) => {
    return await request.get({ url: `/train/venue/get?id=` + id })
  },

  // 新增场地
  createVenue: async (data: Venue) => {
    return await request.post({ url: `/train/venue/create`, data })
  },

  // 修改场地
  updateVenue: async (data: Venue) => {
    return await request.put({ url: `/train/venue/update`, data })
  },

  // 删除场地
  deleteVenue: async (id: number) => {
    return await request.delete({ url: `/train/venue/delete?id=` + id })
  },

  /** 批量删除场地 */
  deleteVenueList: async (ids: number[]) => {
    return await request.delete({ url: `/train/venue/delete-list?ids=${ids.join(',')}` })
  },

  // 导出场地 Excel
  exportVenue: async (params) => {
    return await request.download({ url: `/train/venue/export-excel`, params })
  }
}
